		var jie="";
		 sq="";
		 ee="";
	     function selecttime(){
			clearInterval(selecttime);
					$.ajax({
						xhrFields:{withCredentials: true},
						method:"post",
						url:"http://localhost:16111/activity/huoqusj1",
						dataType:"json",
						success:function(date){
							if(date==""){
													return
												}
							var xzsj=+new Date();
							
								jie=date[0].endtime
								sb=+new Date(date[0].endtime);
								sq=date[0].commodityid;
								ee=date[0].msid;
								

							setInterval(daojishi,100)
							
							if(xzsj>sb){
								gai(date[0].endtime);
							}
					}
				})
				}
				function daojishi () {
					var xzsj=+new Date();//获取当前时间戳
					var jieshi=+new Date(jie)
				
					var djs=(jieshi-xzsj)/1000;
					var shi= parseInt(djs/60/60%24)
					var fen= parseInt(djs/60%60)
					var miao=parseInt(djs%60)
					shi=shi>9?shi:"0"+shi
					miao=miao>9?miao:"0"+miao;
					fen=fen>9?fen:"0"+fen;
					var sj=shi+":"+fen+":"+miao
					
					var a=document.getElementsByClassName("left-img");
					str=""
					a[0].innerHTML=str+sj
					if(jieshi<xzsj){
						 window.location.reload();
					}	
				}

	//时间过期改状态
			function gai (endtime) {
				// alert(endtime);
				$.ajax({
					xhrFields:{withCredentials: true},
					method:"post",
					url:"http://localhost:16111/activity/gai",
					dataType:"json",
					data:{endtime:endtime},
					success:function(date){
						if(date==true){
							alert("本场秒杀活动结束啦，看看最新的秒杀吧~");
							window.location.reload();//刷新页面
						}
				},
				})
			}

				function daojishi () {
					var xzsj=+new Date();//获取当前时间戳
					var jieshi=+new Date(jie)
				
					var djs=(jieshi-xzsj)/1000;
					var shi= parseInt(djs/60/60%24)
					var fen= parseInt(djs/60%60)
					var miao=parseInt(djs%60)
					shi=shi>9?shi:"0"+shi
					miao=miao>9?miao:"0"+miao;
					fen=fen>9?fen:"0"+fen;
					var sj=shi+":"+fen+":"+miao
					
					document.getElementById("shi").innerHTML=shi;
					document.getElementById("fen").innerHTML=fen;
					document.getElementById("miao").innerHTML=miao;
					
					
					if(jieshi<xzsj){
						 window.location.reload();
					}
				}
							

							
				function diyige () {
								
										  window.clearTimeout(diyige)
											var msid=ee
											var commodityid=sq
										
											$.ajax({
												xhrFields:{withCredentials: true},
											method:"post",
												url:"http://localhost:16111/activity/shouye",
												dataType:"json",
												data:{
													commodityid:commodityid,
												msid:msid},
												success:function(date){
													
													st="";
													yj="";
													xj="";
													msj="";
												var	ssr="";
												if(date==""){
													return
												}
													for(i in date){
														yj=date[i].commodity_price
														xj=date[i].spikeprice
														msj=yj-xj
													
													ssr+="<a class='floor-item shanyi'>"+
							"<div class='item-img hot-img'>"+
							"<img  src="+date[i].commodity_picture+" class='cover'>"+
							"</div>"+
							"<div class='price clearfix'>"+
							"<span class='cr fz16'>秒杀价:￥"+msj+"</span>"+
							"<span class='c6 hui-yuan' >原价"+date[i].commodity_price+"</span>"+
							"</div>"+
							"<div class='name ep' title="+date[i].commodity_description+">"+date[i].commodity_description+"</div>"+
							"<input type='button' class='annvnv1' value='立即抢购' onclick='jianshulian("+date[i].category_id+","+date[i].id+")'>"+
							"</a>"
							
													}
													
													document.getElementById("ms").innerHTML=ssr;
													},
												})
										}
									
		function hbyjs() {
				
		}					

	
